{
 
    const markdown = {  
        elementTemplate : ` 
                    <label>{{title}}</label>
                    <div class="panel panel-default" :style="{height : mkHeight, width: mkWidth}" data-replace='markdown'>
                        <div class="panel-heading">这里是一个Markdown的编辑器</div>
                        <div class="panel-body">
                            <h1>这里是一个Markdown的编辑器</h1>
                        </div>
                    </div>
        `,
        prototypeTemplate : ` 
                    <div class="form-group">
                        <label >请输入字段名(唯一):</label>
                        <input type="text" class="form-control input-sm" v-model="name">
                    </div>
                    <div class="form-group">
                        <label >Markdown的标题:</label>
                        <input type="text" class="form-control input-sm" v-model="title">
                    </div>
                    <div class="form-group">
                        <label >Markdown的宽度:</label>
                        <input type="text" class="form-control input-sm" v-model="mkWidth">
                    </div>
                    <div class="form-group">
                        <label >Markdown的高度:</label>
                        <input type="text" class="form-control input-sm" v-model="mkHeight">
                    </div>
        `,

        realTemplate : `
                    <label>{{title}}</label>
                    <div :id="name">
                        <textarea style="display:none;">[TOC]
                            #### Disabled options
                        </textarea>
                    </div>

        `,
        _constructor : function () {
            return { 
                data: {  
                    title : "markdown编辑器：",
                    name : "markdown1",
                    mkWidth : "100%",
                    mkHeight : "580px"
                },

                mounted : function () { 
                    if (typeof $ != 'undefined') {
                        let _this = this; 
                        $(function() {
                            window[_this.name] = editormd(_this.name , {
                                width   : "100%",
                                height  : "100%",
                                syncScrolling : "single",
                                path    : "/form-dist/plugins/editormd/lib/"
                            }); 
                        });
                    }
                },

                methods: { 
                    getValue : function () {
                        return window[this.name].getMarkdown(); //返回MarkDown
                        //return window[this.name].getHTML(); //返回Html
                    },
                    
                    getField : function () {
                        return this.name;
                    }
                }
            }
        }  
    }


    if ( window.TEMPLATE && !window.TEMPLATE.markdown ) {
        window.TEMPLATE.markdown = markdown
    }
}